<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<?php $this->load->view('head'); ?>
</head>

<body>
	<?php $this->load->view('header_admin.php'); ?>
	
	<!-- Content Area -->
	<div class="wrapper-world content">
		<div class="wrapper">
			<h1>Recurring Invoice</h1>
			
			<div class="whitebox-top"><div class="whitebox-bot"><div class="whitebox">
				<ul>
					<li><span>Client:</span> <?php echo anchor('/viewuser/'.$ownerinfo->id, $ownerinfo->name); ?><?php if ($ownerinfo->company): ?> from <?php echo anchor('/companies/view/'.$ownerinfo->company->id, $ownerinfo->company->name); ?><?php endif; ?></li>
					<li><span>Period (Months):</span> <?php echo $rinvoice->period; ?></li>
					<li><span>Start Date:</span> <?php echo $rinvoice->start_date; ?></li>
				</ul>
				<div class="invoice-remarks">
					<span><strong>Remarks</strong></span>
					<br  /><?php echo nl2br(htmlspecialchars($rinvoice->remarks)); ?>
				</div>
				<div class="clr"></div>
					<br/><br/>
				<ul>
					<span><strong>Routes</strong></span>
						<br />
						<?php $routes = json_decode($rinvoice->routes);
						foreach ($routes as $route): ?>
						<li><span>Days:</span> <?php echo implode(", ", $route->weekdays); ?></li>
						<li><span>Pickup locations:</span> <?php foreach ($route->pickup as $pickup): ?><?php echo $pickup->location; ?> at <?php echo $pickup->time; ?><br /><?php endforeach; ?></li>
						<li><span>Drop-off locations:</span> <?php foreach ($route->dropoff as $dropoff): ?><?php echo $dropoff->location; ?> at <?php echo $dropoff->time; ?><?php endforeach; ?></li>
						<li><span>Bus Type:</span> <?php echo $route->bustype; ?></li>
						<li><span>Price, S$:</span> <?php echo $route->price; ?></li>
						<li><span>Tax, %:</span> <?php echo $route->tax; ?></li>
						<li><span>Discount, %:</span> <?php echo $route->discount; ?></li>
						<li><span>Total, S$:</span> <?php echo $route->totalprice; ?></li>
						<?php endforeach; ?>
						<br/><br/>
					<span class="clr"></span>
				</ul>
				<div class="clr"></div>
			</div></div></div>
		</div>
		
		<div class="job-listing">
			<?php
				$c = 0;
				foreach ($invoices as $invoice): ?>
			<div class="wrapper-world job-<?php echo (($c%2 == 0) ? "odd" : "even"); ?>">
				<div class="wrapper">
					<div class="job-id"><?php echo count($invoices) - $c; ?></div>
					<div class="job-details"><?php echo anchor('/invoices/view/'.$invoice->id, 'Issued on '.$invoice->date); ?></div>
					<div class="clr"></div>
				</div>
			</div>
			<?php $c++; endforeach; ?>
		</div>
	</div>	
	
	<!--          -----------------------------------------------------------------------------          -->
	
	
		
	<div class="wrapper-world footer-top">
		<div class="wrapper"></div>	
	</div>
	
	<?php $this->load->view('footer'); ?>
</body>
</html>
